# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQuery do
  @moduledoc """
  A query to find a number of similar entities.

  ## Attributes

  *   `embedding` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQueryEmbedding.t`, *default:* `nil`) - Optional. The embedding vector that be used for similar search.
  *   `entityId` (*type:* `String.t`, *default:* `nil`) - Optional. The entity id whose similar entities should be searched for. If embedding is set, search will use embedding instead of entity_id.
  *   `neighborCount` (*type:* `integer()`, *default:* `nil`) - Optional. The number of similar entities to be retrieved from feature view for each query.
  *   `numericFilters` (*type:* `list(GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQueryNumericFilter.t)`, *default:* `nil`) - Optional. The list of numeric filters.
  *   `parameters` (*type:* `GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQueryParameters.t`, *default:* `nil`) - Optional. Parameters that can be set to tune query on the fly.
  *   `perCrowdingAttributeNeighborCount` (*type:* `integer()`, *default:* `nil`) - Optional. Crowding is a constraint on a neighbor list produced by nearest neighbor search requiring that no more than sper_crowding_attribute_neighbor_count of the k neighbors returned have the same value of crowding_attribute. It's used for improving result diversity.
  *   `stringFilters` (*type:* `list(GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQueryStringFilter.t)`, *default:* `nil`) - Optional. The list of string filters.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :embedding =>
            GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQueryEmbedding.t()
            | nil,
          :entityId => String.t() | nil,
          :neighborCount => integer() | nil,
          :numericFilters =>
            list(
              GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQueryNumericFilter.t()
            )
            | nil,
          :parameters =>
            GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQueryParameters.t()
            | nil,
          :perCrowdingAttributeNeighborCount => integer() | nil,
          :stringFilters =>
            list(
              GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQueryStringFilter.t()
            )
            | nil
        }

  field(:embedding,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQueryEmbedding
  )

  field(:entityId)
  field(:neighborCount)

  field(:numericFilters,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQueryNumericFilter,
    type: :list
  )

  field(:parameters,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQueryParameters
  )

  field(:perCrowdingAttributeNeighborCount)

  field(:stringFilters,
    as: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQueryStringFilter,
    type: :list
  )
end

defimpl Poison.Decoder,
  for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQuery do
  def decode(value, options) do
    GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQuery.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.AIPlatform.V1.Model.GoogleCloudAiplatformV1NearestNeighborQuery do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
